local skynet = require "skynet"

local M = {} 

local roomd

function M.enter_room(room_id, userinfo, agent)
    return skynet.call(roomd, "lua", "enter_room", room_id, userinfo, agent)
end 

function M.leave_room(room_id, userinfo)
    return skynet.call(roomd, "lua", "leave_room", room_id, userinfo.uid)
end 

function M.list_members(room_id, userinfo)
    return skynet.call(roomd, "lua", "list_members", room_id, uid)
end 

function M.say_public(userinfo, msg)
    return skynet.call(roomd, "lua", "say_public", userinfo.uid, msg)
end 

function M.say_private(userinfo, to_uid, msg)
    return skynet.call(roomd, "lua", "say_private", userinfo.uid, to_uid, msg)
end 

function M.kick(from_uid, to_uid)
    return skynet.call(roomd, "lua", "kick", from_uid, to_uid)
end 

function M.send_exp(from_uid, to_uid, exp) 
    return skynet.call(roomd, "lua", "send_exp", from_uid, to_uid, exp)
end 

local function init()
    roomd = skynet.uniqueservice("room")
end 

skynet.init(init)

return M 